package com.atguigu.gmall.list.rpc;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.list.service.GoodsService;
import com.atguigu.gmall.model.list.Goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author A
 * @version 1.0
 * @description: TODO
 * @date 2025/9/6 20:23
 */
@RestController
@RequestMapping("/rpc/inner/list")
public class GoodsRpcController {
    @Autowired
    private GoodsService goodsService;
    @PostMapping("/save")
    public Result saveGoods(@RequestBody Goods goods) {
        goodsService.saveGoods(goods);
        return Result.ok();
    }
    @DeleteMapping("/delete/{skuId}")
    public Result deleteGoods(@PathVariable("skuId") Long skuId) {
        goodsService.deleteGoods(skuId);
        return Result.ok();
    }
    @PutMapping("/updateScore/{skuId}/{score}")
    public Result updateScore(@PathVariable("skuId") Long skuId, @PathVariable("score") Long score) {
        goodsService.updateScore(skuId, score);
        return Result.ok();
    }
}
